// pages/licencePlate/licencePlate.js
const app = getApp()

let addFlag = false
Page({

  /**
   * 页面的初始数据
   */
  data: {
    statusBarHeight: app.globalData.statusBarHeight,
    titleText: '软件注册及隐私协议',
    privacyPolicy:[]

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let that = this;
    that.setData({
      scrollViewHeight: wx.getSystemInfoSync().windowHeight - that.data.statusBarHeight - 44
    })
    if(options.type == 'userServe') {
      this.getUserServePage()
    } else if (options.type == 'privacy') {
      this.getAgreementPage()
    }
  },

  getUserServePage() {
    wx.request({
      url: 'https://mis.lmtc.zmzncs.com/service_Contract.html',
      success:res=>{
        this.setData({ privacyPolicy:res.data })
      }
    })
  },


  getAgreementPage() {
    wx.request({
      url: 'https://mis.lmtc.zmzncs.com/privacy_Policy.html',
      success:res=>{
        this.setData({ privacyPolicy:res.data })
      }
    })
  },
  onShow() {

  },

  //返回上一个页面
  back() {
    wx.navigateBack({ //返回
      delta: 1,
      fail(err) {
        wx.redirectTo({
          url: '/pages/index/index',
        })
      }
    })
  },


  /**
   * 设置value
   * @param {*} e 
   */
  setValue: function (e) {
    var that = this;
    that.setData({
      iptValue: e.detail.value
    });
  },
  /**
   * 自定义键盘点击
   * @param {*} e 
   */
  inputChange(e) {
    let that = this;
    let iptValue = that.data.iptValue;
    let value = e.detail;
    let keyBoardType = that.data.keyBoardType;
    that.setData({
      iptValue: iptValue + value
    })
    if (keyBoardType == 1) {
      that.setData({
        keyBoardType: 2
      })
    }
  },



})